home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware City / Applications / chipmunkbasic3.10 / README.basic < prev    next >
Encoding:
Text File  |  1994-12-20  |  6.9 KB  |  179 lines  |  [TEXT/ttxt]

  1. *chipmunk-basic-3.1.0-fat.hqx README*
  2.  
  3. Every personal computer should have a Basic interpreter; here's one
  4. for the PowerMac (and 68K Macs too).
  5.  
  6. Chipmunk Basic is a simple Basic interpreter, accelerated for
  7. PowerMacs.  It is similar to the line number based MumbleSoft BASIC
  8. interpreters of circa 1980.  Its roots are from a pascal program,
  9. basic.p, that was part of the test input suite to p2c, a pascal to c
  10. translator.  Both basic.p and p2c should be in the net.sources
  11. archives somewhere.  I cleaned up the translated source, ported it to
  12. the Macintosh, fixed various bugs and added several Mac specific
  13. features. 
  14.  
  15. Chipmunk Basic 3.1 is free for non-commercial or educational
  16. distribution and use. (but only for those who don't believe that using
  17. the BASIC language causes brain damage. :-)  Please be aware that there
  18. are far better versions of BASIC available commercially. Just none that
  19. ran PowerPC native and were available for the Mac as of March 14th.
  20. It's not very fast as BASIC systems go. But it does run 150 to 200
  21. times faster on a PowerMac 7100/80 than Microsoft BASIC 1.0 did on my
  22. original Mac 128.
  23.  
  24. Have fun.  And please send me any bugs reports: via email to:
  25. rhn@netcom.com  or via postal mail to:  Ronald Nicholson,
  26. 1909 Magdalena Circle #76,  Santa Clara, CA 95051  USA.
  27.  
  28.  * Chipmunk-Basic is (c) Copyright 1990,1994 Ronald H. Nicholson, Jr.
  29.  * ALL RIGHTS RESERVED
  30.  *
  31.  * Permission to use, copy and distribute this software without fee
  32.  * for non-commercial or educational purposes is hereby granted, provided
  33.  * that the above copyright notice appear in all copies and that both
  34.  * the copyright notice and this permission notice appear in supporting
  35.  * documentation.
  36.  *
  37.  * This program is distributed in the hope that it will be useful, but
  38.  * WITHOUT ANY WARRANTY OF ANY KIND; not even the implied warranty of
  39.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  40.  
  41. PowerMac Version History (summary):
  42.  
  43. 3.1.0 94Nov14  fixed on-gosub bug, input bug; added bigfont options
  44. 3.0.9 94Nov    fixed power mgr bug, val "--" bug, cont bug
  45. 3.0.7 94Oct21  LET bug fixed ; subroutines with parameters fixed,
  46.        ENDIF added, now works on system 6.0.5 and up on 68000 Macs.
  47. 3.0.4 94Sep08  DoScript scriptable; added cicn sprites & picts, scrolling.
  48. 2.9b9  bug fixes for array assignment, copy pict, ppc libs.
  49. 2.9b5  fat binary version. fixed cmd-copy of graphics window.
  50. 2.9b2 94March16  virtual memory crash bug fixed.
  51. 2.9b0 94March14  first native PowerPC port.
  52.  
  53. ---
  54. Quick Reference for Chipmunk Basic v3.1 - PPC Macintosh version 94Nov
  55. ported by Ronald H. Nicholson, Jr.    rhn@netcom.com
  56.  
  57. - The interpreter includes an old fashioned line number based editor.
  58. - The usual amount of numeric and string operators and functions and
  59.     file I/O statements are available.
  60. - The two variable types are long floats and strings with a maximum length
  61.     of 254 characters.  Variable names can be up to 31 characters long and
  62.     are case insensitive.
  63. - Unusual features include:
  64.     The ability to play accurate morse code through the Sound Manager.
  65.     Some simple graphics commands in a separate graphics window.
  66.  
  67. Operators, functions and statements include:
  68.  
  69.     + - * / ^ mod  and or xor not  > < >= <= <> =
  70.     sqr() log() exp() sin() cos() tan() atn()  pi
  71.     abs() sgn() int() rnd() peek() val() asc() len()
  72.     mid$() right$() left$() str$() chr$()
  73.     goto  if then else endif  gosub return
  74.     for to step next  while wend
  75.     rem  let  dim data read restore
  76.     input print open for output append as close# load save
  77.     inkey$  input$ fgetbyte# eof()  fseek#
  78.     run stop end exit quit cont  renum  new clear  def fn
  79.     date$ time$ timer  push() pop  sound morse say  sub
  80.     cls gotoxy moveto lineto  graphics window scrn mouse()
  81.     home get htab vtab pos()  varptr peek() poke fre
  82.     
  83. Some Examples:
  84.  
  85.   for i=1 to 10 : print i : next i
  86.  
  87.   c$ = a$ + b$            : rem string concatenation
  88.   a$ = inkey$            : rem inkey$ is non-blocking 
  89.   
  90.   load "sieve.bas"        : rem load TEXT file as a Basic program
  91.   
  92.   open "filename" for output as #1 : print #1, "hello" : close #1 
  93.   
  94.   gotoxy 0,10 : print "here"        : rem text window (0,0 origin)
  95.   x = pos(0)                : rem text cursor horizontal location
  96.   y = pos(-1)                : rem vertical text cursor location
  97.   
  98.   graphics 0  : moveto 10,10 : lineto 110,80    : rem draw graphics line
  99.   
  100.   sound 440,0.5,30            : rem freq, seconds_duration, vol 0-100
  101.   sound 0,128                : rem play snd resource 128
  102.   morse "CQ DE N6YWU",16,40,13,700    : rem dot_wpm,vol,letter_wpm,freq
  103.   
  104. ---
  105. Some experimental graphics commands:
  106. *The graphics commands in version 3.0 are beta test and may be buggy.*
  107.     
  108.     GRAPHICS 0                // show graphics window
  109.     graphics -1                // hide graphics window
  110.     graphics WINDOW x, y, width, height    // graphics window setup
  111.  
  112.     graphics MOVETO  x,y            // Move pen To x,y
  113.     graphics LINETO  x,y            // draw Line To x,y
  114.     graphics OVAL  x,y            // oval  x wide by y high
  115.     graphics DRAWTEXT  a$            // DrawText
  116.     
  117.     graphics RECT  x1,y1,x2,y2        // FrameRect
  118.     graphics FILLRECT  x1,y1,x2,y2,pat#    // PaintRect
  119.     graphics OVAL  x1,y1,x2,y2        // FrameOval
  120.     graphics FILLOVAL  x1,y1,x2,y2,pat#    // PaintOval
  121.     graphics PENSETUP  xsize, ysize, [ mode, pat# ]
  122.     graphics COLOR  i            // set RGBForeColor by index
  123.     graphics COLOR  r,g,b            // red green blue 0-100
  124.  
  125.     graphics PICT  x,y,n            // draw 'pict' resource n
  126.     graphics TEXTSETUP f, s, m    // font, size, mode
  127.  
  128.     graphics (-38)            // get graphics window max width
  129.     graphics (-39)            // get graphics window max height
  130.  
  131.     SPRITE    n  x, y, id        // sprite n @ x,y using ICN# or cicn id
  132.                     // n from 1 to 15, 1 in frontmost plane
  133.                     // ICN# 128 - 141 included with chipbasic
  134.     sprite    n  UP    x        // sprite #n move up x pixels
  135.     sprite  n  DOWN  x
  136.     sprite  n  LEFT  x        // move LEFT (not turn as in Logo!)
  137.     sprite  n  RIGHT   x
  138.     sprite    n  TURN    d        // turn CCW d degrees
  139.     sprite    n  FORWARD x        // move forward x pixels
  140.     sprite    n  PENUP
  141.     sprite    n  PENDOWN
  142.     
  143. ---
  144. other unusual or experimental features:
  145.  
  146.     open "SFGetFile" for input as #2    // "SFPutFile" works for output
  147.     open "COM1:" for input as #3        //  *requires* CTB Serial Tool
  148.     open f$ for data input as #4    // data file, no crlf text translation
  149.     say "hello world"            //  *requires* the Speech Manager
  150.     say "faster", 196, 44, 1        //  string, rate, pitch, voice
  151.     a$ = field$("aa bb cc dd", 2, " ")    // "bb", similar to awk fields
  152.     sound -1,a(0),11100        // play 1 sec. samples from array a
  153.     macfunc("sendscript", appname$, doscript$)    // send a DoScript AE
  154.  
  155. - "Preferred Size" from Finder Get Info may limit maximum graphics window size
  156. - ICN#, cicn & PICT resources may be stored in the ".bas" program file
  157. - bigfont options in Prefs file
  158. - AppleScript scriptable. Try this script from a script editor:
  159.       tell application "chipbasic" to DoScript "print 3+4"
  160.  
  161. ---
  162. 1 rem "sieve.bas" , a prime number sieve benchmark
  163. 2 t = timer
  164. 3 dim f(8194)
  165. 4 for i = 0 to 8191 : f(i) = 1 : next i
  166. 5 s = 8191
  167. 6 for i = 0 to s
  168. 7   if f(i) = 0 then goto 11
  169. 8   p = i+i+3
  170. 9   for k = i+p to s step p : f(k) = 0 : next k
  171. 10   c = c+1
  172. 11 next i
  173. 12 print c;" primes found in ";
  174. 13 t = timer-t
  175. 14 print t;" seconds"
  176. 15 end
  177.  
  178. --- cut here ---
  179.